Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- actionMap.set('input.welcome', DefaultWelcomeIntent);
- actionMap.set('sign.in', signIn);
- function DefaultWelcomeIntent() {
- app.askForSignIn();
- }
- function signIn(app) {
- if (app.getSignInStatus() === app.SignInStatus.OK) {
- let accessToken = app.getUser().accessToken;
- app.ask('Great, thanks for signing in!');
- } else {
- app.ask('I won't be able to save your data, but let's continue!');
- }
- }
- app.get('/auth', (req, res) => {
- var clientID = Hello123ClientID
- var redirectURL = 'https://oauth-redirect.googleusercontent.com/r/sampleproject'
- var projectID = 'sampleproject'
- var ACCESS_TOKEN = 'SampleTokenXXXXXX'
- var STATE_STRING;
- if (req.query.client_id) {
- if (req.query.client_id != clientID) {
- res.status(503).send("Incorrect ClientID");
- }
- }
- if (req.query.redirect_uri) {
- if (req.query.redirect_uri != redirectURL) {
- res.status(503).send("Incorrect Re-directURL")
- }
- }
- if (req.query.response_type) {
- if (req.query.response_type != 'token') {
- res.status(503).send("Incorrect Response_type")
- }
- }
- if (req.query.state) {
- STATE_STRING = req.query.state
- }
- var responseoAuthURL ;
- responseoAuthURL = 'https://oauth-redirect.googleusercontent.com/r/' + projectID + '#access_token=' + ACCESS_TOKEN + '&token_type=bearer&state=' + STATE_STRING
- res.redirect(responseoAuthURL)
- });
Add Comment
Please, Sign In to add comment