Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Handle case where token has expired... #24

Open
kitplummer opened this issue Sep 23, 2022 · 3 comments
Open

Handle case where token has expired... #24

kitplummer opened this issue Sep 23, 2022 · 3 comments
Assignees

Comments

@kitplummer
Copy link
Contributor

     Running `target\debug\tdi.exe me`
Error: Graph error:
GraphError {
    headers: Some(
        GraphHeaders {
            url: "https://graph.microsoft.com/v1.0/me",
            status: 401,
            header_map: {
                "transfer-encoding": "chunked",
                "content-type": "application/json",
                "strict-transport-security": "max-age=31536000",
                "request-id": "1740feb8-b33a-4c08-a6ee-ab5cfc5a18c4",
                "client-request-id": "1740feb8-b33a-4c08-a6ee-ab5cfc5a18c4",
                "x-ms-ags-diagnostic": "{\"ServerInfo\":{\"DataCenter\":\"South Central US\",\"Slice\":\"E\",\"Ring\":\"5\",\"ScaleUnit\":\"003\",\"RoleInstance\":\"SN4PEPF0000050E\"}}",
                "www-authenticate": "Bearer realm=\"\", authorization_uri=\"https://login.microsoftonline.com/common/oauth2/authorize\", client_id=\"00000003-0000-0000-c000-000000000000\"",
                "date": "Fri, 23 Sep 2022 11:57:49 GMT",
            },
        },
    ),
    code: 401,
    error_message: ErrorMessage {
        error: Some(
            ErrorStatus {
                code: Some(
                    "InvalidAuthenticationToken",
                ),
                message: Some(
                    "Access token has expired or is not yet valid.",
                ),
                inner_error: Some(
                    InnerError {
                        code: None,
                        request_id: Some(
                            "1740feb8-b33a-4c08-a6ee-ab5cfc5a18c4",
                        ),
                        date: Some(
                            "2022-09-23T11:57:50",
                        ),
                    },
                ),
            },
        ),
    },
}
@kitplummer kitplummer self-assigned this Sep 23, 2022
@kitplummer
Copy link
Contributor Author

If this happens, we should refresh the locally stored auth token with a new one, versus the whole auth life cycle, which would be a different error generated if the auth code had expired.

@kitplummer
Copy link
Contributor Author

kitplummer commented Sep 25, 2022

The refresh_token is not coming back with the authorization_code flow in the graph-rs lib. Need to investigate more.

@kitplummer
Copy link
Contributor Author

sreeise/graph-rs-sdk#380 - asking the question upstream.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant