Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

404 not found when testing the AADv2 Auth Sample #5464

Closed
muhualing opened this issue Jul 15, 2019 · 9 comments
Closed

404 not found when testing the AADv2 Auth Sample #5464

muhualing opened this issue Jul 15, 2019 · 9 comments
Assignees
Labels
Bot Services Required for internal Azure reporting. Do not remove. Do not change color. customer-replied-to Indicates that the team has replied to the issue reported by the customer. Do not delete. customer-reported Issue is created by anyone that is not a collaborator in the repository.

Comments

@muhualing
Copy link

when I tested the auth bot sample, I met 404not found error

SDK Platform: Nodejs
SDK Version: 3.16.0
Active Channels: Teams
Deployment Environment: Azure Bot Service

Error: GET to 'https://api.botframework.com/api/usertoken/GetToken?userId=29%3A1R5vQA_0_OF8C4zi2Sy5uQs77pFKXs6Jxx1-UW7fABq7XqkNQ_CrL-lstObXd3RL6MVj_UZIC1PQ3fZGh-YdNFA&connectionName=ConnectionNameV2' failed: [404] Not Found

mycode:

connector.getUserToken(session.message.address, connectionName, undefined, (err, result) => {
    if (result) {
        // If there is already a token, the bot can use it directly
        session.send('You are already signed in with token: ' + result.token);
    } else {
        // If there not is already a token, the bot can send an OAuthCard to have the user log in
        if (!session.userData.activeSignIn) {
            session.send("Hello! Let's get you signed in!");
            builder.OAuthCard.create(connector, session, connectionName, "Please sign in", "Sign in", (createSignInErr, signInMessage) =>
            {
                if (signInMessage) {
                    session.send(signInMessage);
                    session.userData.activeSignIn = true;
                } else {
                    session.send("Something went wrong trying to sign you in.");
                }     
            });
        } else {
            // Some clients require a 6 digit code validation so we can check that here
            session.send("Let's see if that code works...");
            connector.getUserToken(session.message.address, connectionName, session.message.text, (err2, tokenResponse) => {
                if (tokenResponse) {
                    session.send('It worked! You are now signed in with token: ' + tokenResponse.token);
                    session.userData.activeSignIn = false;
                } else {
                    session.send("Hmm, that code wasn't right");
                }
            });
        }
    }
});

The Client id in the OAuth connection is my bot's AppId, the Client secret is my bot's password, and the Tenant ID is the bot's domain.
The connection name is also right(the one in Azure)
image

@jwiley84 jwiley84 self-assigned this Jul 18, 2019
@jwiley84
Copy link

That is a older sample. Let me see if I can figure out what's going on

@jwiley84
Copy link

Have you tested your connection in the app portal?

image

@muhualing
Copy link
Author

Have you tested your connection in the app portal?

image

Sure, I tested it and I can get a token.

@jwiley84
Copy link

Good! It means your OAuth is set up right. Investigating!

@jwiley84
Copy link

Just to toss it out there: I believe the issue is the channel. Teams takes some special handling. Can you test your oauth in another channel?

@CoHealer
Copy link

@muhualing , can you please acknowledge? Otherwise we'll have to close the issue.Thanks.

@sgellock sgellock added customer-replied-to Indicates that the team has replied to the issue reported by the customer. Do not delete. customer-reported Issue is created by anyone that is not a collaborator in the repository. labels Aug 1, 2019
@sgellock
Copy link
Member

sgellock commented Aug 1, 2019

should this have lived in the samples repo?

@jwiley84
Copy link

jwiley84 commented Aug 1, 2019

This belongs in either v3 or sevices repo.

@CoHealer
Copy link

CoHealer commented Aug 5, 2019

@muhualing I'm closing this for lack of response. If you still need assistance please re-open.

@CoHealer CoHealer closed this as completed Aug 5, 2019
@CoHealer CoHealer added the Bot Services Required for internal Azure reporting. Do not remove. Do not change color. label Aug 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bot Services Required for internal Azure reporting. Do not remove. Do not change color. customer-replied-to Indicates that the team has replied to the issue reported by the customer. Do not delete. customer-reported Issue is created by anyone that is not a collaborator in the repository.
Projects
None yet
Development

No branches or pull requests

4 participants