README.md in ralyxa-1.3.0 vs README.md in ralyxa-1.4.0
- old
+ new
@@ -89,10 +89,20 @@
persisted_data = request.session_attribute("persist")
ask("You persisted: #{ persisted_data }")
end
```
+##### Reading the session user
+
+You can read the session user's `userId` and `accessToken`, and check that the `accessToken` exists:
+
+```ruby
+request.user_id #=> returns the `userId` value from the request session
+request.user_access_token # => returns the `accessToken` value from the request session
+request.user_access_token_exists? # => true if the user has an access token, false if not
+```
+
> Go check out the `Alexa::Request` object to see what else you can do with the `request`.
##### Ending sessions
If, for some reason, you want to end a session in some other way than with a `tell`, you can:
@@ -140,9 +150,21 @@
ask("What do you think of the Standard card I just sent?", card: standard_card)
end
```
> Card images must be under 2MB and available at an SSL-enabled (HTTPS) endpoint.
+
+##### Account Linking
+
+You can ask Alexa to send a [`LinkAccount`](https://developer.amazon.com/blogs/post/Tx3CX1ETRZZ2NPC/Alexa-Account-Linking-5-Steps-to-Seamlessly-Link-Your-Alexa-Skill-with-Login-wit) card for the user to authenticate via OAuth:
+
+```ruby
+intent "SendAccountLinkingCard" do
+ tell("Please authorize via the Alexa app.", card: link_account_card)
+end
+```
+
+After completing authentication, the user's access token is available via `request.user_access_token`. You can check for its existence with `request.user_access_token_exists?`.
## Development
After checking out the repo, run `bundle install` to install dependencies. Then, run `rspec` to run the tests. You can also run `irb` for an interactive prompt that will allow you to experiment.